package com.black.cat.jvm.instructions.stores.xastore;


import com.black.cat.jvm.instructions.base.InstructionNoOperands;
import com.black.cat.jvm.rtda.Frame;
import com.black.cat.jvm.rtda.JObject;
import com.black.cat.jvm.rtda.OperandStack;

public class AASTORE extends InstructionNoOperands {

    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.operandStack();
        JObject ref = stack.popRef();
        int idx = stack.popInt();
        JObject arrRef = stack.popRef();

        checkNotNull(arrRef);
        Object[] refs = arrRef.refs();
        checkIndex(refs.length, idx);
        refs[idx] = ref;

    }

}
